package panels;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.basic.Label;

import home.Home;

@SuppressWarnings("serial")
public class BodyPanel extends MyPanel {

	public BodyPanel(Home home) {
		super("body", home);
	}

	@Override
	public void changePanel(AjaxRequestTarget target) {
		this.getHome().getBody().replaceWith(this);
		this.getHome().changePanel(target,this);
		this.getHome().setBody(this);
		this.setErrorMessage(target, "");
	}
	
	protected void setErrorMessage(AjaxRequestTarget target,String mensaje){
		Label label = new Label("error",mensaje);
		this.getHome().getError().replaceWith(label);
		this.getHome().setError(label);
		label.setOutputMarkupId(true);
		label.setOutputMarkupPlaceholderTag(true);
		target.add(label);
	}

}
